package exercise;
import java.util.*;
//双指针快排
public class Qort0 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for(int i = 0;i<n;i++){
            arr[i] = sc.nextInt();
        }
        qort(arr,0,n-1);
        for (int i = 0;i<n;i++){
            System.out.print(arr[i]+" ");
        }
    }

    private static void qort(int[] arr, int l, int r) {
        if(l >= r){
            return;
        }
        int x = arr[l+r>>1];
        int i = l-1;
        int j = r+1;
        while(i < j){
            do i++;while (arr[i] < x);
            do j--;while (arr[j] > x);
            if(i < j){
                int temp = arr[i];
                arr[i] = arr[j];
                arr[j] = temp;
            }
        }
        qort(arr,l,j);
        qort(arr,j+1,r);
    }
}
